package com.jic.weamop.controller;

import com.jic.weamop.weBankAMOP.service.ContractService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.bcos.channel.dto.ChannelResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * Created by messigao on 2018/7/23.
 */
@RestController
@Slf4j
@RequestMapping("/test")
@Api(tags = "AMOP 测试控制类")
public class TestController {

    @Autowired
    ContractService contractService;


    @ApiOperation(value = "AMOP 测试方法 testAmop")
    @GetMapping("/testAmop")
    //客户端代码，服务端实现callback逻辑
    public void testAmop() throws Exception {
        log.info("======================AMOP==================================");
        try {
            ChannelResponse response = contractService.getMessageService().sendMessage("nodefront", "10001", "amop Test");
        } catch (Exception e) {
            System.out.println("testAmop1:" + e);
            log.info("======================AMOP 异常==================================");
        }
    }

}
